Lets look at snowcover for YELL, in October. The understory phenocam images for that month looks interesting, with snowfall and periods of snow coming and going thruout the month:
A screenshot of the YELL understory phenocam images for October 2019
site = "YELL"
if(!file.exists("octoberSnow.RDS")){
# Make a sequence of dates that we're interested in, in Oct
# Is this needlessly complicated? Yes.
october=1:lubridate::days_in_month(10) %>%
stringr::str_pad(string = ., width = 2, side = "left", pad = "0") %>%
paste0("2019-10-", .)
# generate a list of phenocam urls
phenoUrls=lapply(october, function(date) ytBangerz::getPhenoUrls(site = site, date = date)) %>%
unlist %>%
na.omit() %>%
as.character()
snowPortion=lapply(phenoUrls, ytBangerz::detectSnow) %>% unlist()
# we had to drop some urls for not having noon urls. what did we get
availableDates=stringr::str_extract(string = phenoUrls, pattern = "[0-9]{4}_[0-9]{2}_[0-9]{2}") %>%
gsub(pattern = "_", replacement = "-")
octoberSnow=data.frame("Date"=as.Date(availableDates),"Portion"=snowPortion*100)
saveRDS(octoberSnow, file = "octoberSnow.RDS")
}else{
octoberSnow=readRDS("octoberSnow.RDS")
}
knitr::kable(octoberSnow)
| Date | Portion |
|---|---|
| 2019-10-01 | 36.024425 |
| 2019-10-02 | 44.196007 |
| 2019-10-03 | 8.816110 |
| 2019-10-04 | 6.601509 |
| 2019-10-05 | 46.060909 |
| 2019-10-06 | 0.000000 |
| 2019-10-07 | 0.000000 |
| 2019-10-11 | 50.360844 |
| 2019-10-12 | 44.129420 |
| 2019-10-13 | 38.639117 |
| 2019-10-14 | 34.569616 |
| 2019-10-15 | 13.368961 |
| 2019-10-16 | 6.321921 |
| 2019-10-17 | 4.861587 |
| 2019-10-18 | 6.973022 |
| 2019-10-19 | 4.825198 |
| 2019-10-20 | 73.535856 |
| 2019-10-21 | 70.996514 |
| 2019-10-22 | 49.130944 |
| 2019-10-23 | 73.043458 |
| 2019-10-24 | 68.130049 |
| 2019-10-25 | 32.481805 |
| 2019-10-26 | 71.871094 |
| 2019-10-27 | 37.558585 |
| 2019-10-28 | 48.191015 |
| 2019-10-29 | 42.374733 |
| 2019-10-30 | 39.073217 |
| 2019-10-31 | 59.709457 |
savedImage=paste0(site, " 2019.png")
if(!file.exists(savedImage)){
p=ggplot2::ggplot(data=octoberSnow, ggplot2::aes(x=Date, y=Portion))+
ggplot2::geom_path(na.rm = T, color="#0e1675")+
ggplot2::geom_area(fill="#6449fc", alpha=0.4)+
ggplot2::scale_x_date(date_breaks = "1 month", date_labels = "%B")+
ggplot2::scale_y_continuous(limits = c(0, 100))+
ggplot2::ggtitle(label = paste0(site, " Snow Coverage"),
subtitle = "Percent of understory phenocamera image classified as snow")+
ggplot2::theme_bw()+ggplot2::theme(axis.text.x = ggplot2::element_text(angle=-45, vjust = -.7))
p=ggplot2::ggplot(data=octoberSnow, ggplot2::aes(x=Date, y=Portion))+
#ggplot2::geom_step()+
ggplot2::geom_col(width = 1, alpha=0.8,
fill="#0e1675")+
# ggplot2::geom_col(na.rm = T, color="#0e1675", fill="#0e1675")+
# ggplot2::geom_area(fill="#6449fc", alpha=0.4)+
ggplot2::scale_x_date(date_breaks = "1 week", date_labels = "%D")+
ggplot2::scale_y_continuous(limits = c(0, 100))+
ggplot2::ggtitle(label = paste0(site, "- October 2019 Snow Coverage"),
subtitle = "Percent of understory phenocamera image classified as snow")+
ggplot2::theme_bw()+ggplot2::theme(axis.text.x = ggplot2::element_text(angle=-45, vjust = -.7))
ggplot2::ggsave(filename = savedImage, plot = p, device = "png", width = 6, height = 4, units = "in", dpi = 180)
}
A screenshot of the YELL understory phenocam images for October 2019